'use strict';

/**
 * @param {Egg.Application} app - egg application
 */
module.exports = app => {
  const { router, controller } = app;
  //router.get('/v1/index', controller.home.index);
  /** 文件有关的API */
  router.post('/v1/file/uploadFile', controller.file.index);
  router.delete('/v1/file/deleteFile/:file_id', controller.file.deleteFile);
  /** 用户有关的API */
  router.post('/v1/user/login', controller.home.login);
  router.post('/v1/user/submitOrder/:open_id', controller.home.submitOrder);
  router.get('/v1/user/getSimpleOrders/:open_id', controller.home.getSimpleOrders);
  router.get('/v1/user/getDetailOrder/:order_id', controller.home.getDetailOrder);
  router.get('/v1/user/getAddress/:open_id', controller.home.getAddress);
  router.get('/v1/user/getAddressDetail/:address_id',controller.home.getAddressDetail);
  router.post('/v1/user/increaseAddress/:open_id', controller.home.increaseAddress);
  router.put('/v1/user/updateAddress/:address_id', controller.home.updateAddress);
  router.delete('/v1/user/deleteAddress/:address_id', controller.home.deleteAddress);
  router.put('/v1/user/setDefaultAddress', controller.home.setDefaultAddress);
  router.get('/v1/user/getPickerDatas', controller.home.getPickerDatas);
  router.put('/v1/user/updateSelectSchool', controller.home.updateSelectSchool);
  router.get('/v1/user/getSelectSchoolInfo/:school_id',controller.home.getSelectSchoolInfo)
  router.get('/v1/user/getUserInfo/:open_id', controller.home.getUserInfo);
  router.get('/v1/user/getShopBySchoolId/:school_id',controller.home.getShopBySchoolId);

  /** 客户端有关API */
  router.post('/v1/client/login',controller.client.login);
  router.get('/v1/client/modifyOrderStatus',controller.client.modifyOrderStatus);

  /** 管理端有关API */
  router.get('/v1/admin/getSchools',controller.admin.getSchools);
  router.get('/v1/admin/getShops',controller.admin.getShops);
  router.get('/v1/admin/getAreas',controller.admin.getAreas);
  router.post('/v1/admin/addSchool',controller.admin.addSchool);
  router.post('/v1/admin/addShop',controller.admin.addShop);
  router.post('/v1/admin/addArea',controller.admin.addArea);
  router.delete('/v1/admin/deleteSchool/:school_id',controller.admin.deleteSchool);
  router.delete('/v1/admin/deleteShop/:shop_id',controller.admin.deleteShop);
  router.delete('/v1/admin/deleteArea/:area_id',controller.admin.deleteArea);
  router.get('/v1/admin/order/getSimpleOrders',controller.admin.getSimpleOrders);
  router.get('/v1/admin/order/getOrder',controller.admin.getOrder);
  router.get('/v1/admin/getDetailOrder/:order_id',controller.home.getDetailOrder);
  //时间问题 编辑功能暂不开发2022-4-12
  router.put('/v1/admin/putSchool/:school_id',controller.admin.putSchool);
  router.put('/v1/admin/putShop/:shop_id',controller.admin.putSchool);
  router.put('/v1/admin/putArea/:area_id',controller.admin.putSchool);
  
  
};
